<template>
   <div class="app-container">
    <el-card class="operate-container" shadow="never">
      
         <el-button
       	type="primary"
        @click="handleDeleteImage()"
        size="mini">
       删除多余图片
      </el-button>
      

    </el-card>
   
  </div>
</template>
<script type="text/javascript">
	
	import {deleteUseless} from '@/api/image'

	export default {
	    name: "imageClean",
	    data() {
	      return {

	      
	      }
	    },
	   
	    methods:{
	    	 
		    handleDeleteImage() {
		        this.$confirm('是否要删除多余图片！', '提示', {
		          confirmButtonText: '确定',
		          cancelButtonText: '取消',
		          type: 'warning'
		        }).then(() => {
		          	 this.$confirm('再次确认是否要删除多余图片？', '提示', {
				          confirmButtonText: '确定',
				          cancelButtonText: '取消',
				          type: 'warning'
				        }).then(() => {
				        	deleteUseless().then(response=>{
					    		
					    		this.$message({
						                type: 'success',
						                message: '删除成功',
						                duration:1000
						             });

					    	}).catch(() => {
		          				this.$message({
					                type: 'error',
					                message: '删除失败',
					                duration:1000
					            });
		          
		       				});


				        }).catch(() => {
		          				
		          			console.log("error1")
		       			 });
		          
		        }).catch(() => {
		          	
		          
		        });
		      }
	    }
	    
	}
	
	
</script>